package com.notelapierdas.twitter;

import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class AlmacenCredenciales {
	private SharedPreferences prefs;

	public AlmacenCredenciales(SharedPreferences prefs) {
		this.prefs = prefs;
	}

	public String[] lee() {
		String[] tokens = new String[2];
		tokens[0] = prefs.getString("token", "");
		tokens[1] = prefs.getString("token_secret", "");
		return tokens;
	}

	public void escribe(String[] tokens) {
		Editor editor = prefs.edit();
		editor.putString("token", tokens[0]);
		editor.putString("token_secret", tokens[1]);
		editor.commit();
	}

	public void borra() {
		Editor editor = prefs.edit();
		editor.remove("token");
		editor.remove("token_secret");
		editor.commit();
	}

}
